using System;
using System.Collections.Generic;
using System.Text;

namespace Objects
{
    public class Duyet
    {
        #region Duyet variables

        private int _Id;

        private int _IdDangKy;
        private int _IdNguoiDung;


        private DateTime _NgayDuyet;

        private String _GhiChu;

        private int _TrangThaiDuyet;
        private int _Status;
        private int _SapXep;

        #endregion

        #region Duyet properties

        public int Id
        {
            get { return _Id; }
            set { _Id = value; }
        }

        public int IdDangKy
        {
            get { return _IdDangKy; }
            set { _IdDangKy = value; }
        }

        public int IdNguoiDung
        {
            get { return _IdNguoiDung; }
            set { _IdNguoiDung = value; }
        }

        public DateTime NgayDuyet
        {
            get { return _NgayDuyet; }
            set { _NgayDuyet = value; }
        }

        public String GhiChu
        {
            get { return _GhiChu; }
            set { _GhiChu = value; }
        }

        public int TrangThaiDuyet
        {
            get { return _TrangThaiDuyet; }
            set { _TrangThaiDuyet = value; }
        }

        public int Status
        {
            get { return _Status; }
            set { _Status = value; }
        }

        public int SapXep
        {
            get { return _SapXep; }
            set { _SapXep = value; }
        }

        #endregion

        #region IPopulatable<Duyet> Members

        public Duyet Populate(System.Data.DataRow reader)
        {
            Duyet item = new Duyet();

            try { item.Id = Convert.ToInt32(reader["Id"].ToString()); }
            catch { item.Id = -1; }

            try { item.IdDangKy = Convert.ToInt32(reader["IdDangKy"].ToString()); }
            catch { item.IdDangKy = -1; }

            try { item.IdNguoiDung = Convert.ToInt32(reader["IdNguoiDung"].ToString()); }
            catch { item.IdNguoiDung = -1; }

            try { item.NgayDuyet = Convert.ToDateTime(reader["NgayDuyet"].ToString()); }
            catch { item.NgayDuyet = DateTime.MinValue; }

            
            item.GhiChu = Convert.ToString(reader["GhiChu"].ToString());

            item.TrangThaiDuyet = Convert.ToInt32(reader["TrangThaiDuyet"].ToString());

            item.Status = Convert.ToInt32(reader["Status"].ToString());
            item.SapXep = Convert.ToInt32(reader["SapXep"].ToString());

            return item;
        }

        #endregion
    }
}
